<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<script type="text/javascript"
	src="/resources/admin/lagu/lib/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript"
	src="/resources/admin/lagu/lib/datatables/dataTables.plugins.js"></script>
<link rel="stylesheet"
	href="/resources/admin/lagu/lib/datatables/css/table_jui.css"
	type="text/css" />
<script type="text/javascript">
	function articlesDelete(id) {
		LG.articlesDelete(id,function(json){
			if(json.success) {
				$("#articles-all-"+id).remove();
			}
		});
	}
	function getTrString(jsonData) {
		if (typeof jsonData.tags == 'undefined') {
			jsonData.tags = "";
		}
		var result = "<tr id='articles-all-" + jsonData.id + "'><td><a href='#')'>" + jsonData.title
				+ "</a></td><td>" + jsonData.status + "</td><td>"
				+ jsonData.postDate + "</td><td>" + jsonData.modifiedDate
				+ "</td><td>" + jsonData.tags
				+ "</td><td><a href='javascript:void(0)' onclick='articlesDelete(" + jsonData.id + ")'>删除</a></td></tr>";
		return result;
	}
	$(document).ready(function() {
		LG.articlesAll(function(json) {
			var data = eval("(" + json.data + ")").data;
			$.each(data, function(k, v) {
				$("#articles-all-tbody").append(getTrString(v));
			});
			$('#articles-all-table').dataTable({
				"bSort" : false,
				"bDestroy" : true,
				"oLanguage" : {
					'sSearch' : '搜索:',
					"sLengthMenu" : "",
					"sZeroRecords" : "没有数据...",
					"sInfo" : "显示 _START_ 至 _END_ 共 _TOTAL_ 条",
					"sInfoEmpty" : "显示 0 至 0 共 0 条",
					"sInfoFiltered" : "(_MAX_)",
					"oPaginate" : {
						"sFirst" : "第一页",
						"sPrevious" : "上一页",
						"sNext" : "下一页",
						"sLast" : "最后一页"
					}
				}
			});
		});
	});
</script>
<div class="dp100">
	<div class="sepH_c">
		<table id="articles-all-table" class="display formEl_a">
			<thead>
				<tr>
					<th><div class="th_wrapp">标题</div></th>
					<th><div class="th_wrapp">状态</div></th>
					<th><div class="th_wrapp">发布日期</div></th>
					<th><div class="th_wrapp">修改日期</div></th>
					<th><div class="th_wrapp">标签</div></th>
					<th><div class="th_wrapp">操作</div></th>
				</tr>
			</thead>
			<tbody id="articles-all-tbody">
			</tbody>
		</table>
	</div>
</div>